<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta content="telephone=no" name="format-detection"/>
    <meta name="viewport"
          content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable = no"/>
    <title>商品推荐</title>
    <link href="__PUBLIC__/wap/css/rest.css"  rel="stylesheet">
    <link href="__PUBLIC__/wap/css/mbusiness.css"  rel="stylesheet">
</head>
<body>
<!--绑定头部-->
<include file="Public/binding_head"/>
<!--绑定头部-->
<header id="header" class="u-header clearfix">
    <div class="u-hd-left f-left">
        <a href="javascript:history.go(-1);" class="J_backToPrev"><span class="u-icon-px i-hd-back"></span></a>
    </div>
    <div class="u-hd-tit"><span>商品推荐</span></div>
    <div class="u-hd-right f-right"><a href="{:U('wap/Index/index')}" mars_sead="nav_home_btn"><span
            class="u-icon-m i-hd-home"></span></a></div>
</header>
<div class="" style="margin: 10px 10px;">
    <ul class="i_ul rel more_html">
        <volist name="data" id="vo">
            <li class="i_li left">
                <a href="{:U('wap/goods/goods_detail',array('id'=>$vo['goods_id']))}">
                    <div class="i_li_img_div wrap">
                        <div class="i_li_img_div_inner">
                                <span class="sellerOut">
                                    <img src="{:U('wap/index/get_thumbs',array('auto'=>240))}?img={$vo.goods_img}">
                                </span>
                        </div>
                    </div>
                    <p class="i_txt">{$vo.goods_name}</p>
                    <p class="i_pri_wrap">
                        <span class="i_pri">¥{$vo.shop_price} <s class="s_price" style="">¥{$vo.market_price}</s></span>
                    </p>
                </a>
            </li>
        </volist>
    </ul>
</div>
<div class="b_q">
    <div class="fm-footer-copyright get_more">
        <if condition="$count gt 10 && count($list) eq 10">
            加载更多
            <else/>
            无更多数据
        </if>
    </div>
</div>
<input type="hidden" name="p" data="2" value="2"/>
<input type="hidden" name="id" value="{$_GET['id']}"/>
<!--end 版权-->
<div class="bottom-to-top" style="display: block; transform-origin: 0px 0px 0px; opacity: 1; transform: scale(1, 1);">
    <img src="__PUBLIC__/wap/img/scroll-to-top-icon.png" style="width: 100%;">
</div>
<!--end top-->
<include file="Public/footer"/>
<!--end 页脚-->
<include file="Public/wap_javascript"/>
<script type="text/javascript">
    var binding_is_check = 0;// 重复再次弹出 1是 0否
    var binding_page = 'goods_goods_relative';// //当前页面名称 不可重复
</script>
<!--绑定-->
<include file="Public/binding_phone"/>
<!--绑定-->
<script type="text/javascript">
 var load_more = 0;
 var load_none = 0;
    $(function () {
       
        $(window).scroll(function () {
            var scrollTop = $(this).scrollTop();
            var scrollHeight = $(document).height();
            var windowHeight = $(this).height();
            if (scrollTop + windowHeight == scrollHeight) {
                //此处是滚动条到底部时候触发的事件，在这里写要加载的数据，或者是拉动滚动条的操作
                if (load_none != 1) {
                    if (load_more == 1) {
                        var html = ' <img src="__PUBLIC__/wap/img/icon_zhuan.gif" style="max-width:15px;">'
                        $('.get_more').html('加载中' + html);
                    } else {
                        get_more();
                    }
                }
            }
        });
    })

    $(function () {
        $(".get_more").click(function () {
            get_more();
        });
        $(".all_chk").click(function () {
            //$("input[name='p']").val(1);
            $("input[name='p']").attr('data', 1);
            $("input[name='type']").val("");
            get_more();
        });
        $(".zhekou").click(function () {
            var data = $(this).attr('data');
            var zk = "";
            if (data == 1) {
                $(this).attr('data', '2')
                zk = "prices1";
                $(this).find('i').addClass('p-sx-x');
                $(this).find('i').removeClass('p-sx-s');
            } else {
                $(this).find('i').addClass('p-sx-s');
                $(this).find('i').removeClass('p-sx-x');
                $(this).attr('data', '1')
                zk = "prices2";
            }
            //$("input[name='p']").val(1);
            $("input[name='p']").attr('data', 1);
            $("input[name='order']").val(zk);
            get_more();
        });

    });
    function get_more() {
        load_more = 1;
        var html = ' <img src="__PUBLIC__/wap/img/icon_zhuan.gif" style="max-width:15px;">'
        $('.get_more').html('加载中' + html);
        //var p=$("input[name='p']").val();
        var p = $("input[name='p']").attr('data');
        var id = $("input[name='id']").val();
        $.ajax({
            url: "{:U('wap/goods/goods_relative')}",
            type: 'get',
            data: {p: p,id:id},
            dataType: 'json',
            success: function (data) {
//                console.log(data);
                var con = 1;
                var option = '';
                if (data) {
                    $.each(data,function (i, value) {
                        //this指向当前元素
                        //i表示Array当前下标
                        //value表示Array当前元素
                        option = option +'<li class="i_li left">'+
                                '<a href="<?php echo U('wap/goods/goods_detail'); ?>?id='+this.goods_id+'">'+
                        '<div class="i_li_img_div wrap">'+
                        '<div class="i_li_img_div_inner">'+
                        '<span class="sellerOut">'+
                        '<img src = "<?php echo U('wap/index/get_thumbs',array('auto'=>240)); ?>?img='+value.goods_img+'" >'+
                        '</span></div></div>'+
                        '<p class="i_txt">'+this.goods_name+'</p>'+
                        '<p class="i_pri_wrap">'+
                        '<span class="i_pri">¥'+this.shop_price+'<s class="s_price" style="">¥'+this.market_price+'</s></span>'+
                        '</p></a></li>'+
                        con++;
                    });
                }
                //$('.more_html').append(option);
                if (p == 1) {
                    $('.more_html').html(option);
                } else {
                    $('.more_html').append(option);
                }
                load_more = 0;
                if (option) {
                    //$("input[name='p']").val(parseInt(p)+1);
                    $("input[name='p']").attr('data', parseInt(p) + 1);
                }
                if (con < 10) {
                    load_none = 1;
                    $('.get_more').html('无更多数据');
                }
            }
        });
    }
</script>

</body>
</html>